Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-100228: Warn from os.fork() if other threads exist. #100229

Merged
merged 20 commits into from
Dec 29, 2022

Conversation

gpshead
Copy link
Member

@gpshead gpshead commented Dec 14, 2022

Not comprehensive, best effort warning. There are cases when threads exist that this code currently does not detect.

Starting with a DeprecationWarning for now, it is less disruptive than something like RuntimeWarning and most likely to only be seen in people's CI tests - a good place to start with this messaging.

TODO:

  • doctests for multiprocessing failed with an assertion crash in 2854473 about the error being set unexpectedly on one later commit, why? did I fix that? I need to figure out how to run those and try to reproduce it. (could not reproduce, no way it could be related seen upon code inspection)

Not comprehensive, best effort.
@netlify
Copy link

netlify bot commented Dec 14, 2022

Deploy Preview for python-cpython-preview canceled.

Name Link
🔨 Latest commit a91a4d1
🔍 Latest deploy log https://app.netlify.com/sites/python-cpython-preview/deploys/639aae96df45c9000879b05a

* Only warn in the parent process.
* Add a test to test_os that a non-Python thread triggers the warning.
* Avoid the system calls to count threads if we've already warned once.
* The macOS API calls were written blind based on docs, will fix later
  if CI fails.
I don't want the array of thread info but it may insist?
Modules/posixmodule.c Show resolved Hide resolved
Modules/posixmodule.c Outdated Show resolved Hide resolved
Modules/posixmodule.c Show resolved Hide resolved
Lib/test/test_os.py Outdated Show resolved Hide resolved
Modules/_testcapimodule.c Outdated Show resolved Hide resolved
Modules/posixmodule.c Show resolved Hide resolved
Modules/posixmodule.c Outdated Show resolved Hide resolved
Xavier-Do added a commit to odoo-dev/odoo that referenced this pull request Apr 26, 2024
Since python 3.12 python/cpython#100229, fork
inside a multithreaded process will raise a warning.

We actually have another solution to get rid of the fork that was
implemented in more recent versions.
robodoo pushed a commit to odoo/odoo that referenced this pull request Apr 26, 2024
Since python 3.12 python/cpython#100229, fork
inside a multithreaded process will raise a warning.

We actually have another solution to get rid of the fork that was
implemented in more recent versions.

closes #163562

Signed-off-by: Christophe Monniez (moc) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants